package vue.panneau1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class PopupChoixLibelleVariables2D extends JPanel implements ActionListener
{
	private static final long serialVersionUID = 1L;
	private Interface2DZone1 z1;
	private JDialog fen;
	private JLabel labelX1,labelX2;
	private JTextField jtfLibX1,jtfLibX2;
	private JButton bvalider;
	
	public PopupChoixLibelleVariables2D(Interface2DZone1 z1)
	{
		this.z1=z1;
		
		labelX1 = new JLabel("  Libellé X1 :");
		labelX2 = new JLabel("  Libellé X2 :");	
		
		jtfLibX1 = new JTextField(12);
		jtfLibX2 = new JTextField(12);
		
		jtfLibX1.setText(z1.obtenirLibelleX1());
		jtfLibX2.setText(z1.obtenirLibelleX2());
		
		bvalider = new JButton("Valider");
		bvalider.addActionListener(this);
		
		this.setLayout(new GridLayout(0,2));
		add(labelX1);
		add(jtfLibX1);
		add(labelX2);				
		add(jtfLibX2);
		add(new JLabel(""));
		add(bvalider);		
		
		fen = new JDialog();
		fen.add(this);
		fen.setTitle("Libellés");		
		fen.setLocationRelativeTo(z1);
		fen.setResizable(false);
		fen.setAlwaysOnTop(true);
		fen.pack();
		fen.setVisible(true);
	}

	public void actionPerformed(ActionEvent e) 
	{			
		z1.choisirLibelleX1X2(jtfLibX1.getText(),jtfLibX2.getText());
		fen.dispose();
	}
}

